<?php 

require("../include/config.php");
require("../API/php/fonctions.php");
require("../API/php/header.php");

// phpsql/mysql_getInfoToc.php?milis=123456789&idtoc=1201836870 

//[x][0] = id_toc
//[x][1] = priorite
//[x][2] = statut
//[x][3] = duree_reel

// IN obligatoire
$arrayGet = array(
    "idtoc" => null
);

$arrayValeur = recupGet($arrayGet, $bolDecode);

if($arrayValeur["error"] == null){
	// CONNECION SQL
	$db = mysql_connect($host, $base, $mdp)  or die('Erreur de connexion '.mysql_error());

	// CONNECION BASE
	mysql_select_db($base,$db)  or die('Erreur de selection '.mysql_error());
	
	$sql = "SELECT a.`id_toc`, `priorite`, `statut`, `duree_reel` FROM `vm_inventaire_tocs` a, `vm_durees` b WHERE 1=1 AND a.id_toc = b.id_toc and a.revision = 0
and a.id_toc = '".$arrayValeur["idtoc"]."'
	;";
	
	$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); 

	// on fait une boucle qui va faire un tour pour chaque enregistrement 
	while($data = mysql_fetch_assoc($req)) 
	{ 
		$strSorti .= $data['id_toc'].'&'.$data['priorite'].'&'.$data['statut'].'&'.$data['duree_reel']
		.'&'
		."\r\n"; 
	}

	// DECONNECION SQL
	mysql_close();
}else{
	$strSorti = "ERROR:".$arrayValeur["error"];
}

require("../API/php/footer.php");
?>